package top.koqia.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import top.koqia.service.IRandomCallService;
import top.koqia.vo.MapDto;

@RestController
@CrossOrigin
@Api(tags = "随机点名")
@RequestMapping("random")
public class RandomCall {
    @Autowired
    private IRandomCallService randomCallService;

    @ApiOperation("随机点名")
    @RequestMapping("call")
    public MapDto random(@ApiParam("点名人数,默认为1") @RequestParam(value = "num", defaultValue = "1") String num, @ApiParam("点名类型") @RequestParam(value = "type", defaultValue = "JAVA") String type) {
        return randomCallService.randomCall(num, type);
    }

    @ApiOperation("每组随机点名一个")
    @RequestMapping("groupcall")
    public MapDto randomGroup(@ApiParam("点名类型") @RequestParam(value = "type", defaultValue = "JAVA") String type) {
        return randomCallService.randomCall(type);
    }
}
